import React, { useEffect, forwardRef } from "react";
import ChildrenComp from "./ChildrenComp";
const ForwardChildrenComp = forwardRef(ChildrenComp);

export default function MyFuncComp() {
  const ref = React.createRef(null);
  useEffect(() => {
    // 这里打印的是 id 为 targetDiv 的真实 DOM
    console.log("ref :>> ", ref.current);
  });
  return (
    <>
      <ForwardChildrenComp ref={ref} />
    </>
  );
}
